<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// admin/acat_$global.php Page have the html Of the adding Categories                                                                *\
// Powered by Shumool Information Technology                                                                                     *\
// Contact Data                                                                                                                  *\
// WEb site : http://www.shumool.com                                                                                            *\ // E-mail : info@shumool.com                                                                                                     *\
// Ver 1.00 Demo started at 5/4/2009                                                                                             *\
// Please Don't Remove This Copy rights                                                                                          *\
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
session_start();
include ("../sys/shumool.php");
$redirect="index.php";
dosession($redirect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EGYPT CTMC NONWOVENS CO</title>
<link href="css/dgstyle.css" rel="stylesheet" type="text/css" />
<link href="css/shumool.css" rel="stylesheet" type="text/css">
<script language="javascript">
function addgmcheck()
{
if (addgm.name.value=="")
{
alert("Please enter name");
document.addgm.name.focus();
return false;
}
}
</script> 
</head>
<body>
<br />
<?php if (isset($_POST['Submit']))
{
addcat_$global($globalpost);
echo "<script>alert('The operation took place successfully');</script>";
echo "<meta http-equiv='Refresh' content='0;url=vcat_$global.php'>";
}
else
{
if (isset($_GET['doo'])=='ed' and isset($_GET['ids']))
{
$fields="*";
$tbl = 'cat_$global';
$where = ' id=' . $_GET['ids'];
$ordered = ' id';
$arrange = ' desc';
$limit = ' 1';
$a=selectdb($fields,$tbl,$where,$ordered, $arrange, $limit);
$b=mysql_fetch_array($a[0]);
}
?>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" class="dgTotRowsTR">
 <form action="" method="post" name="addgm" onsubmit="return addgmcheck();" enctype="multipart/form-data"> <tr>
    <td colspan="2" align="center" bgcolor="#ECE9D8"><?php if (!isset($doo)){?>Add New Category<?php }else if (isset($_GET['doo'])=='ed'){?>Edit Category<?php } ?></td>
  </tr>
  <tr>
    <td width="26%" align="left" style="padding-right:30px;"> * Name</td>
    <td width="74%" align="left"><input name="name" type="text" class="dgRowsTot" size="30" value="<?php echo @$b['name'];?>" /></td>
    
  </tr>
    <tr>
    <td width="26%" align="left" style="padding-right:30px;"> * Pic</td>
    <td width="74%" align="left">
	<input type="hidden" name="MAX_FILE_SIZE" value="8000000" >
	<input type="file" name="photo" class="texts" dir="ltr">
	<?php 
	if (isset($doo)){$imagenew="../" . $b['image'];
	if (file_exists($imagenew)){?><a href="<?php echo @$imagenew?>" target="_blank">
	<img src="<?php echo $imagenew;?>" width="50" height="50" border="0" /></a><?php }?>
	<?php if($b['image']!=''){?><input type="checkbox" value="1" name="dellimg" title="Delete Image" /><?php }?>
	<?php } ?>
	</td>
  </tr>
    <tr>
    <td width="26%" align="left" style="padding-right:30px;"> * Show</td>
    <td width="74%" align="left">
	<input name="cshow" type="checkbox" <?php if (isset($_GET['doo'])=='ed'){ if (isset($b['cshow'])==1){?> checked="checked"<?php } } else{?>  checked="checked"<?php } ?> class="dgRowsTot" value="1"/></td>
    
  </tr>
   <tr>
    <td colspan="2" align="center"><?php if (isset($b)){?><input type='hidden' name='doo' value='ed'>
	<input type='hidden' name='ids' value='<?php echo @$_GET['ids'];?>'><?php } ?>	
	<input type="button" value="View Categories" class="dgAjax" onclick="javascript:location.href('vcat_$global.php');" />
	<input type="submit" name="Submit" value="<?php if (isset($b)){?>Edit<?php }else{ ?>Add<?php } ?>" class="dgAjax" style="width:75px;" /></td>
    </tr>
 </form>
</table>

<?php } ?>
</body>
</html>
